package com.tudouji.project.d3.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tudouji.framework.aspectj.lang.annotation.Log;
import com.tudouji.framework.aspectj.lang.enums.BusinessType;
import com.tudouji.project.d3.domain.D3OrderTodo;
import com.tudouji.project.d3.service.ID3OrderTodoService;
import com.tudouji.framework.web.controller.BaseController;
import com.tudouji.framework.web.domain.AjaxResult;
import com.tudouji.common.utils.poi.ExcelUtil;
import com.tudouji.framework.web.page.TableDataInfo;

/**
 * 待处理D3Controller
 * 
 * @author tudouji
 * @date 2023-04-14
 */
@RestController
@RequestMapping("/d3/todo")
public class D3OrderTodoController extends BaseController
{
    @Autowired
    private ID3OrderTodoService d3OrderTodoService;

    /**
     * 查询待处理D3列表
     */
    @PreAuthorize("@ss.hasPermi('d3:todo:list')")
    @GetMapping("/list")
    public TableDataInfo list(D3OrderTodo d3OrderTodo)
    {
        startPage();
        List<D3OrderTodo> list = d3OrderTodoService.selectD3OrderTodoList(d3OrderTodo);
        return getDataTable(list);
    }

    /**
     * 导出待处理D3列表
     */
    @PreAuthorize("@ss.hasPermi('d3:todo:export')")
    @Log(title = "待处理D3", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(D3OrderTodo d3OrderTodo)
    {
        List<D3OrderTodo> list = d3OrderTodoService.selectD3OrderTodoList(d3OrderTodo);
        ExcelUtil<D3OrderTodo> util = new ExcelUtil<D3OrderTodo>(D3OrderTodo.class);
        return util.exportExcel(list, "todo");
    }

    /**
     * 获取待处理D3详细信息
     */
    @PreAuthorize("@ss.hasPermi('d3:todo:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(d3OrderTodoService.selectD3OrderTodoById(id));
    }

    /**
     * 新增待处理D3
     */
    @PreAuthorize("@ss.hasPermi('d3:todo:add')")
    @Log(title = "待处理D3", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody D3OrderTodo d3OrderTodo)
    {
        return toAjax(d3OrderTodoService.insertD3OrderTodo(d3OrderTodo));
    }

    /**
     * 修改待处理D3
     */
    @PreAuthorize("@ss.hasPermi('d3:todo:edit')")
    @Log(title = "待处理D3", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody D3OrderTodo d3OrderTodo)
    {
        return toAjax(d3OrderTodoService.updateD3OrderTodo(d3OrderTodo));
    }

    /**
     * 删除待处理D3
     */
    @PreAuthorize("@ss.hasPermi('d3:todo:remove')")
    @Log(title = "待处理D3", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(d3OrderTodoService.deleteD3OrderTodoByIds(ids));
    }
}
